package com.zhuyi.broadcast.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhuyi.broadcast.pojo.domain.Resource;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 *  资源Mapper 接口
 * </p>
 *
 * @author dyj
 * @since 2024-12-11
 */
@Mapper
public interface ResourceMapper extends BaseMapper<Resource> {

    /**
     * 根据关键字查询资源列表
     * @param keyword 关键字
     * @return 资源列表
     */
    default List<Resource> searchByKeyword(String keyword) {
        return selectList(
                new LambdaQueryWrapper<Resource>()
                        .like(Resource::getResourceName, keyword) // 根据资源名称搜索
        );
    }
}
